package com.geline.demo.web;

import com.geline.easyexcel.manager.EasyExcelManager;
import com.geline.easytrans.service.EasyTransService;
import com.geline.extension.domain.TableDataInfo;

import javax.annotation.Resource;
import java.util.List;

/**
 * Excel导出支持
 *
 * @author: mx
 * @date: 2024-07-25 14:54
 */
public abstract class AbstractExcelController extends RequestInterceptor{

    @Resource
    protected EasyTransService easyTransService;
    @Resource
    protected EasyExcelManager excelManager;

    /**
     * 导出Excel
     * @param reportCode
     * @param tableDataInfo
     */
    protected void exportExcel(String reportCode, TableDataInfo tableDataInfo, String title) {
        List list = tableDataInfo.getRows();
        easyTransService.transBatch(list);
        excelManager.exportPageExcel(getResponse(), reportCode, list, true, title);
    }
}
